package receivers;

import com.example.maze.LobbyActivity;

import tw.edu.tku.im.maze.Room;
import tw.edu.tku.im.maze.RoomListRep;
import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

public class UpdateRoomsListRepReceiver extends BroadcastReceiver {
   Activity currentUIActivity;
   
   //[ -------------------- construct --------------------
   public UpdateRoomsListRepReceiver(Activity activity) {
      this.currentUIActivity= activity;
   }
   //[ -------------------- construct --------------------
   
   // --------------------------------------------------
   @Override
   public void onReceive(Context context, Intent intent) {
      Room[] rooms= ((RoomListRep)intent.getParcelableExtra("packet")).getList();
      
      ((LobbyActivity)currentUIActivity).update(rooms);   
      
   }
   // --------------------------------------------------
}
